package cn.ymjr.sys.config.weixin;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

/**
 * Created by xinchao on 2017/11/13 0013.
 */
@Configuration
public class WeiXinConfig {

    @Autowired
    private Environment environment;

  //  @Value("${weiXinApiUtil.AppID}")
    private static String appId;
  //  @Value("${weiXinApiUtil.AppSecret}")
    private static String appSecert;

 //   @Value("${weiXinApiUtil.ACCESS_TOKEN}")
    private static String accessToken;
 //   @Value("${weiXinApiUtil.JSAPI_TICKET}")
    private static String jsApiTicket;
 //   @Value("${weiXinApiUtil.GET_OAUTH_CODE}")
    private static String getOauthCode;
 //   @Value("${weiXinApiUtil.GET_OAUTH_TOKEN}")
    private static String getOauthToken;
 //   @Value("${weiXinApiUtil.GET_OAUTH_USERINFO}")
    private static String getOauthUserInfo;
 //   @Value("${weiXinApiUtil.SEND_MESSAGE}")
    private static String sendMessage;

    @Bean
    public int  WeiXinConfig(){
        WeiXinConfig.setAppId(environment.getProperty("weiXinApiUtil.AppID"));
        WeiXinConfig.setAppSecert(environment.getProperty("weiXinApiUtil.AppSecret"));
        WeiXinConfig.setAccessToken(environment.getProperty("weiXinApiUtil.ACCESS_TOKEN"));
        WeiXinConfig.setGetOauthCode(environment.getProperty("weiXinApiUtil.GET_OAUTH_CODE"));
        WeiXinConfig.setJsApiTicket(environment.getProperty("weiXinApiUtil.JSAPI_TICKET"));
        WeiXinConfig.setGetOauthToken(environment.getProperty("weiXinApiUtil.GET_OAUTH_TOKEN"));
        WeiXinConfig.setGetOauthUserInfo(environment.getProperty("weiXinApiUtil.GET_OAUTH_USERINFO"));
        WeiXinConfig.setSendMessage(environment.getProperty("weiXinApiUtil.SEND_MESSAGE"));

        return 1;
    }

    public static String getAppId() {
        return appId;
    }

    public static void setAppId(String appId) {
        WeiXinConfig.appId = appId;
    }

    public static String getAppSecert() {
        return appSecert;
    }

    public static void setAppSecert(String appSecert) {
        WeiXinConfig.appSecert = appSecert;
    }

    public static String getAccessToken() {
        return accessToken;
    }

    public static void setAccessToken(String accessToken) {
        WeiXinConfig.accessToken = accessToken;
    }

    public static String getJsApiTicket() {
        return jsApiTicket;
    }

    public static void setJsApiTicket(String jsApiTicket) {
        WeiXinConfig.jsApiTicket = jsApiTicket;
    }

    public static String getGetOauthCode() {
        return getOauthCode;
    }

    public static void setGetOauthCode(String getOauthCode) {
        WeiXinConfig.getOauthCode = getOauthCode;
    }

    public static String getGetOauthToken() {
        return getOauthToken;
    }

    public static void setGetOauthToken(String getOauthToken) {
        WeiXinConfig.getOauthToken = getOauthToken;
    }

    public static String getGetOauthUserInfo() {
        return getOauthUserInfo;
    }

    public static void setGetOauthUserInfo(String getOauthUserInfo) {
        WeiXinConfig.getOauthUserInfo = getOauthUserInfo;
    }

    public static String getSendMessage() {
        return sendMessage;
    }

    public static void setSendMessage(String sendMessage) {
        WeiXinConfig.sendMessage = sendMessage;
    }
}
